﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ChineseSchool.Models.Hethong;
using System.Data;

namespace ChineseSchool.BLL
{
    public class B_Role
    {
        private PetaPoco.Database db;
        public B_Role()
        {
            db = new PetaPoco.Database("ConnectionString");
        }        

        public List<M_Role> GetAlls()
        {
            var Role = db.Fetch<M_Role>(@";EXEC Role_Get_List");
            return Role;
        }

        // Select by ID
        public M_Role Selectby_id(int RoleID)
        {
            var loadmenu = db.SingleOrDefault<M_Role>("SELECT * FROM Role bc WHERE bc.RoleID = " + RoleID + ";");
            db.CloseSharedConnection();
            return loadmenu;
        }        
    }
}